﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="ProductInStockMananger.aspx.cs" Inherits="MLM.ProductInStockMananger" meta:resourcekey="PageResource1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadGrid ID="RadProductInStocksGrid" runat="server" AllowFilteringByColumn="True"
        DataSourceID="GroupProductInStocksEds" AllowPaging="True" AllowSorting="True"
        GridLines="None" ShowGroupPanel="True"  AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" 
        ShowFooter="True" ShowStatusBar="True" 
        meta:resourcekey="RadProductInStocksGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="StockID,ProductBaseID"
            DataSourceID="GroupProductInStocksEds" ShowHeader="true" ShowHeadersWhenNoRecords="true"
            AllowAutomaticInserts="true" CommandItemDisplay="TopAndBottom">
            <%--<MasterTableView ShowFooter="false" DataKeyNames="ProductID" EditMode="InPlace" CommandItemDisplay="TopAndBottom">--%>
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true">
                <%--ExportToPdfText="Export to Pdf">--%></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
             <telerik:GridBoundColumn DataField="ProductInStockID" HeaderText="ProductInStockID"
                    ReadOnly="True" SortExpression="ProductInStockID" 
                    UniqueName="ProductInStockID" Visible="false" 
                    meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Stock.Name" HeaderText="Stock"
                    ReadOnly="True" SortExpression="StockID" UniqueName="StockID" 
                    meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductBas.Name" HeaderText="Product" SortExpression="ProductBaseID"
                    UniqueName="ProductBaseID" ReadOnly="True" 
                    meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="StockAvaiable" HeaderText="StockAvaiable" SortExpression="StockAvaiable"
                    UniqueName="StockAvaiable" DataType="System.Int64" 
                    meta:resourcekey="GridBoundColumnResource4">
                </telerik:GridBoundColumn>               
                <telerik:GridCheckBoxColumn DataField="IsShowOnShop" DataType="System.Boolean" HeaderText="IsShowOnShop"
                    SortExpression="IsShowOnShop" UniqueName="IsShowOnShop" 
                    meta:resourcekey="GridCheckBoxColumnResource1">
                </telerik:GridCheckBoxColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                    UniqueName="EditCommandColumn" 
                    meta:resourcekey="GridEditCommandColumnResource1">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="DeleteColumn" meta:resourcekey="GridButtonColumnResource1">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
                <FormTemplate>
                    <table id="Table2" style="border-collapse: collapse; padding-left: 20">
                        <tr class="EditFormHeader" style="height: 30">
                            <td style="font-size: small" colspan="2">
                                <b><asp:Label runat="server" ID="lbproductdetails" Text="Product Details" 
                                    meta:resourcekey="lbproductdetailsResource1"></asp:Label></b>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbStock" Text="Stock:" 
                                    meta:resourcekey="lbStockResource1"></asp:Label>
                            </td>
                            <td style="width: 50">
                                <telerik:RadComboBox CssClass="rancombox" ID="RadComboBox3" runat="server" DataTextField="Name"
                                    DataValueField="StockID" DataSourceID="GroupStocksEds" SelectedValue='<%# Bind("StockID") %>'
                                    AutoPostBack="True" EnableLoadOnDemand="True" 
                                    meta:resourcekey="RadComboBox3Resource1">
                                    <HeaderTemplate>
                                        <ul>
                                            <li style="list-style-type: none" class="col1">Stock</li>
                                        </ul>
                                    </HeaderTemplate>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbproductbase" Text="ProductBase:" 
                                    meta:resourcekey="lbproductbaseResource1"></asp:Label>
                            </td>
                            <td style="width: 30">
                                <telerik:RadComboBox CssClass="rancombox" ID="RadComboBox2" runat="server" DataTextField="Name"
                                    DataValueField="ProductBaseID" DataSourceID="GroupProductEds" 
                                    SelectedValue='<%# Bind("ProductBaseID") %>' 
                                    meta:resourcekey="RadComboBox2Resource1">
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbStockAvaiable" Text="StockAvaiable:" 
                                    meta:resourcekey="lbStockAvaiableResource1"></asp:Label>
                            </td>
                            <td>
                                <telerik:RadNumericTextBox CssClass="radtextbox" ID="RadNumericTextBox1" runat="server"
                                    Text='<%# Bind("StockAvaiable") %>' Culture="en-US" LabelCssClass="" 
                                    meta:resourcekey="RadNumericTextBox1Resource1">
                                    <NumberFormat DecimalDigits="0" />
                                </telerik:RadNumericTextBox>
                                <asp:RequiredFieldValidator ID="NumercTextBoxRequiredFieldValidator" runat="server"
                                    Display="Dynamic" ControlToValidate="RadNumericTextBox1" 
                                    ErrorMessage="Please, select an number!" 
                                    meta:resourcekey="NumercTextBoxRequiredFieldValidatorResource1"></asp:RequiredFieldValidator>
                            </td>
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbIsShowOnShop" Text="IsShowOnShop:" 
                                    meta:resourcekey="lbIsShowOnShopResource1"></asp:Label>
                            </td>
                            <td>                                                 
                                 <asp:CheckBox ID="CheckIsOnShop" runat="server" TabIndex="1" 
                                     Checked='<%# Bind("IsShowOnShop") %>' meta:resourcekey="CheckIsOnShopResource1">
                                </asp:CheckBox>     
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 10; padding-top: 10" colspan="2">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" 
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    meta:resourcekey="btnUpdateResource1">
                                </asp:Button>&nbsp;
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel" meta:resourcekey="btnCancelResource1"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <%-- <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>--%>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="GroupProductInStocksEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="ProductInStocks" 
        Include="ProductBas,Stock">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupStocksEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Stocks" 
        EntityTypeFilter="Stock">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupProductEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="ProductBases">
    </asp:EntityDataSource>
</asp:Content>
